// 创建路由
import Vue from 'vue'
import Router from 'vue-router'
import Login from '@/views/Login'
import Home from '@/views/Home'
import welcome from '@/views/welcome'
import users from '@/views/users'
import Role from '@/views/auth/Role'
import Rights from '@/views/auth/Rights'
import goods from '@/views/product/goods'
import params from '@/views/product/params'
import categories from '@/views/product/categories'
Vue.use(Router)

export default new Router({
  routes: [ // 创建路由规则
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {// 创建主页路由
      path: '/Home',
      name: 'Home',
      component: Home,
      redirect: {name: 'welcome'},
      // 创建欢迎页面welcome  Home下面的子路由
      children: [
        { path: 'welcome', name: 'welcome', component: welcome },
        { path: 'users', name: 'users', component: users },
        {
          path: 'Role',
          name: 'Role',
          component: Role
        },
        {
          path: 'Rights',
          name: 'Rights',
          component: Rights
        },
        {
          path: 'goods',
          name: 'goods',
          component: goods
        },
        {
          path: 'params',
          name: 'params',
          component: params
        },
        {
          path: 'categories',
          name: 'categories',
          component: categories
        }

      ]
    }
  ]
})
